package com.leyou.items.feign;

import com.leyou.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient("item-service")
public interface GoodsFeign  {

    /**
     * 获取分类的完整路径
     * @param cid1
     * @param cid2
     * @param cid3
     * @return
     */
    @RequestMapping("/category/getCname")
    public R getCategoryAllNameByid(@RequestParam("cid1") Long cid1 ,
                                    @RequestParam("cid2") Long cid2 ,
                                    @RequestParam("cid3") Long cid3 );


    /**
     * 根据spuid 获取sku信息
     * @param sid
     * @return
     */
    @RequestMapping("/sku/info/{sid}")
    public R getInfoBySpuId(@PathVariable("sid") Long sid);

    /**
     * 根据id获取信息
     * @param id
     * @return
     */
    @RequestMapping("/spu/info/{id}")
    public R info(@PathVariable("id") Long id);


    /**
     * 根据分类id  获取属性分组及分组下的所有属性
     * @param cid
     * @return
     */
    @GetMapping("/specgroups/GroupAttrByCid/{cid}")
    public R getGroupAttrByCid(@PathVariable("cid") Long cid);

    /**
     * 根据分类id查询属性信息
     * @param cid
     * @return
     */
    @GetMapping("/specparams/cid")
    public R listByCid(@RequestParam("cid") Long cid);

    /**
     * 根据spuid 获取商品详细信息
     */
    @RequestMapping("/spudetail/info/{spuId}")
    public R SpuDetailInfo(@PathVariable("spuId") Long spuId);

    /**
     * 根据品牌id 获取信息
     * @param id
     * @return
     */
    @RequestMapping("/brand/info/{id}")
    public R getBreadInfoById(@PathVariable("id") Long id);
}